package cn.wh.transaction.jdbc;

import cn.wh.session.TransactionIsolationLevel;
import cn.wh.transaction.Transaction;
import cn.wh.transaction.TransactionFactory;

import javax.sql.DataSource;
import java.sql.Connection;

/**
 * @Author wh
 * @Description  JdbcTransaction 工厂
 * @Date 2023/1/29 16:33
 * @Version 1.0
 **/
public class JdbcTransactionFactory implements TransactionFactory {
    @Override
    public Transaction newTransaction(Connection conn) {
        return new JdbcTransaction(conn);
    }

    @Override
    public Transaction newTransaction(DataSource dataSource, TransactionIsolationLevel level, boolean autoCommit) {
        return new JdbcTransaction(dataSource,level,autoCommit);
    }
}
